package com.yangyang.ralearn.message;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.apache.log4j.Logger;
import org.jboss.netty.channel.Channel;

import com.yangyang.ralearn.common.JEnvironment;
import com.yangyang.ralearn.common.entity.base.AbstractDomainPredicate;
import com.yangyang.ralearn.net.message.AbstractRespMessage;
import com.yangyang.ralearn.net.message.Message;
import com.yangyang.ralearn.net.message.MessageId;
import com.yangyang.ralearn.net.serialize.AutoSerializable;
import com.yangyang.ralearn.server.JSimulator;
import com.yangyang.ralearn.util.Object2String;

@Message(id = MessageId.RESP_OBSERVE)
public class RespObserveMessage extends AbstractRespMessage {

	@AutoSerializable(index = 1)
	private String data = "";
	private List<AbstractDomainPredicate> currentStates;

	public void init(String data) {
		this.data = data;
	}

	public List<AbstractDomainPredicate> getCurrentStates() {
		return currentStates;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onGetServerMessage(int groupId, int simulatorId, Channel channel) {
		// TODO Auto-generated method stub
		List<AbstractDomainPredicate> list = new Object2String<List<AbstractDomainPredicate>>()
				.string2Object(data);
		currentStates = list;
		// Logger.getLogger(RespObserveMessage.class).debug(list);
	}

}
